<template>
	<view>
		<scroll-view scroll-y>
			<!-- 轮播 -->
			<swiper class="screen-swiper" :class="dotStyle?'square-dot':'round-dot'" :indicator-dots="true"
				:circular="true" :autoplay="true" interval="5000" duration="500">
				<swiper-item v-for="(item,index) in swiperList" :key="index">
					<image :src="item.url" mode="aspectFill" v-if="item.type=='image'"></image>
					<video :src="item.url" autoplay loop muted :show-play-btn="false" :controls="false"
						objectFit="cover" v-if="item.type=='video'"></video>
				</swiper-item>
			</swiper>

			<!--  -->
			<view class="bg-white">
				<view class="grid margin-bottom text-center col-4">
					<view class="padding" v-for="(item,indexs) in appList1" :key="indexs">
						<view>
							<view class="cu-avatar lg round" :style="'background-image:url('+item.icon+');'"></view>
							<view class=" text-xs text-gray text-bold margin-top-xs">{{item.text}}</view>
						</view>
					</view>
				</view>
			</view>

			<view class="bg-white">
				<view class="grid margin-bottom text-center col-2">
					<view class="padding service" v-for="(item,indexs) in appList2" :key="indexs">
						<view class="flex p-xs mb-sm">
							<view class="flex-treble radius service-text-wrapper">
								<text class="service-text">{{item.text}}</text>
							</view>
							<view class="flex-sub radius padding-sm">
								<image class="service-icon" :src="item.icon"></image>
							</view>
						</view>
					</view>
				</view>
			</view>

			<view class="bg-white padding" @click="loveClick()">
				<view class="bg-img bg-mask flex align-center"
					style="background-image: url('/static/school/表白墙.gif');height: 414upx;">
					<view class="padding-xl text-white">
						<view class="padding-xs text-xxl text-bold">
							表白墙
						</view>
						<view class="padding-xs text-lg">
							I love U
						</view>
					</view>
				</view>
			</view>

			<view class="cu-list menu" :class="[menuBorder?'sm-border':'',menuCard?'card-menu margin-top':'']">
				<view class="cu-item arrow" :class="menuArrow?'arrow':''">
					<view class="content">
						<image src="/static/school/跑腿APP.png" class="png" mode="aspectFit"></image>
						<text class="text-grey">校园跑腿</text>
					</view>
				</view>
			</view>
			<div style="height: 400px;">

			</div>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				swiperList: [{
					id: 0,
					type: 'image',
					url: 'https://ossweb-img.qq.com/images/lol/web201310/skin/big84000.jpg'
				}, {
					id: 1,
					type: 'image',
					url: 'https://ossweb-img.qq.com/images/lol/web201310/skin/big37006.jpg',
				}, {
					id: 2,
					type: 'image',
					url: 'https://ossweb-img.qq.com/images/lol/web201310/skin/big39000.jpg'
				}, {
					id: 3,
					type: 'image',
					url: 'https://ossweb-img.qq.com/images/lol/web201310/skin/big10001.jpg'
				}, {
					id: 4,
					type: 'image',
					url: 'https://ossweb-img.qq.com/images/lol/web201310/skin/big25011.jpg'
				}, {
					id: 5,
					type: 'image',
					url: 'https://ossweb-img.qq.com/images/lol/web201310/skin/big21016.jpg'
				}, {
					id: 6,
					type: 'image',
					url: 'https://ossweb-img.qq.com/images/lol/web201310/skin/big99008.jpg'
				}],
				appList1: [{
						'icon': 'https://ossweb-img.qq.com/images/lol/web201310/skin/big99008.jpg',
						'text': '美团'
					},
					{
						'icon': 'https://ossweb-img.qq.com/images/lol/web201310/skin/big10006.jpg',
						'text': '饿了么'
					},
					{
						'icon': 'https://ossweb-img.qq.com/images/lol/web201310/skin/big99008.jpg',
						'text': '微信'
					},
					{
						'icon': 'https://ossweb-img.qq.com/images/lol/web201310/skin/big99008.jpg',
						'text': 'QQ'
					},
					{
						'icon': 'https://ossweb-img.qq.com/images/lol/web201310/skin/big99008.jpg',
						'text': '美团'
					},
					{
						'icon': 'https://ossweb-img.qq.com/images/lol/web201310/skin/big99008.jpg',
						'text': '饿了么'
					},
					{
						'icon': 'https://ossweb-img.qq.com/images/lol/web201310/skin/big99008.jpg',
						'text': '微信'
					},
					{
						'icon': 'https://ossweb-img.qq.com/images/lol/web201310/skin/big99008.jpg',
						'text': 'QQ'
					},
				],
				appList2: [{
						'icon': '/static/school/applist2/11.png',
						'text': '二手市场'
					},
					{
						'icon': '/static/school/applist2/12.png',
						'text': '失物招领'
					},
					{
						'icon': '/static/school/applist2/21.png',
						'text': '团团书店'
					},
					{
						'icon': '/static/school/applist2/22.png',
						'text': '电影购票'
					},

				],
				dotStyle: false,
				menuBorder: false,
				menuArrow: false,
				menuCard: false,
			}
		},
		methods: {
			MenuBorder(e) {
				this.menuBorder = e.detail.value
			},
			MenuArrow(e) {
				this.menuArrow = e.detail.value
			},
			MenuCard(e) {
				this.menuCard = e.detail.value
			},
			bookClick: function(){
				uni.navigateTo({
					url: '/pages/home/book',
					success: (res) => {
						console.log(res);
					},
					fail: (res) => {
						console.log(res);
					}
				})
			},
			lostClick: function(){
				uni.navigateTo({
					url: '/pages/home/lost',
					success: (res) => {
						console.log(res);
					},
					fail: (res) => {
						console.log(res);
					}
				})
			},
			loveClick: function(){
				uni.navigateTo({
					url: '/pages/home/love',
					success: (res) => {
						console.log(res);
					},
					fail: (res) => {
						console.log(res);
					}
				})
			},
			marketClick: function(){
				uni.navigateTo({
					url: '/pages/home/market',
					success: (res) => {
						console.log(res);
					},
					fail: (res) => {
						console.log(res);
					}
				})
			},
			movieClick: function(){
				uni.navigateTo({
					url: '/pages/home/movie',
					success: (res) => {
						console.log(res);
					},
					fail: (res) => {
						console.log(res);
					}
				})
			},
			runClick: function(){
				uni.navigateTo({
					url: '/pages/home/run',
					success: (res) => {
						console.log(res);
					},
					fail: (res) => {
						console.log(res);
					}
				})
			},
		},

	}
</script>

<style>
	.service-icon {
		width: 52px;
		height: 52px;
	}

	.service {
		border: 0.01px solid #eee;
	}

	.service-text-wrapper {
		position: relative;
	}

	.service-text {
		position: absolute;
		transform: translate(-50%, -50%);
		width: 100%;
		top: 50%;
		left: 50%;
	}
</style>